#include<iostream>
#include<set>
#include<algorithm>
typedef long long ll;
const int N = 1e6 + 10;
using namespace std;
ll a[N];
int main()
{
	ll n, k;cin >> n >> k;
	for (ll i = 1; i <= n; i++)
	{
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n);
	for (int i = 1; i <= n; i++)
	{
		cout << a[i] << ' ';
	}cout << endl;
	ll count = 0;
	for (ll i = 1; i <= n; i++)
	{
		if (a[i] == a[i + 1])
		{
			continue;
		}
		count++;
		if (count == k)
		{
			if (a[count] == a[count + 1])
			{
				cout << "-1" << endl;
			}
			else cout << a[count] + 1;
		}
	}
	return 0;
}